import React, { Component } from 'react';
import { connect } from 'dva';
import { Card, Row, Col, Button, Collapse, message, InputNumber, Icon, Modal } from 'antd';
import Factory from '../../factory';
import numeral from 'numeral';
import dataEditCreate from '../../addons/DataEdit'
import DataEditTable from '../../addons/DataEditTable'
const daoName = "BaseEvaCalc";
const { Panel } = Collapse;
const renderNumber = (num) => {
  let value = ''
  if (num) {
    value = numeral(num).format('0,0.00')
  } else {
    value = '0'
  }
  return value
};
//内部评级，减值计提比例
const NBPJ_JZLTBL = [
  { value: '0', label: '0', xs: 0 },
  { value: '0-1', label: '0-1', xs: 0.030 },
  { value: '0-2', label: '0-2', xs: 0.050 },
  { value: '0-3', label: '0-3', xs: 0.090 },
  { value: '1', label: '1', xs: 0.17 },
  { value: '2', label: '2', xs: 0.35 },
  { value: '3', label: '3', xs: 0.54 },
  { value: '4', label: '4', xs: 0.84 },
  { value: '5', label: '5', xs: 1.30 },
  { value: '6', label: '6', xs: 1.86 },
  { value: '7', label: '7', xs: 2.67 },
  { value: '8', label: '8', xs: 3.82 },
  { value: '9', label: '9', xs: 5.47 },
  { value: '10', label: '10', xs: 9.14 },
  { value: '11', label: '11', xs: 15.28 },
  { value: '12', label: '12', xs: 25.54 },
  { value: '13', label: '13', xs: 50.54 },
  { value: 'D', label: 'D', xs: 100 },
  { value: 'zt', label: '直贴', xs: 1 },
  { value: 'qt', label: '其它', xs: 1 },
]
//资产业务类别
const ZCYWLB = [
  { value: '11', label: "一般企业贷款", xs: 0 },
  { value: '12', label: "普惠小微企业贷款", xs: -0.5 },
  { value: '22', label: "绿色贷款", xs: -0.3 },
  { value: '23', label: "中长期制造业贷款", xs: -0.15 },
  // { value: '13', label: "民营企业贷款", xs: 0 },

  { value: '14', label: "票据直贴", xs: 0 },
  { value: '15', label: "同业直投", xs: 0 },
  { value: '24', label: "公司信用债", xs: 0 },
  { value: '25', label: "承兑汇票", xs: 0 },
  { value: '26', label: "保函", xs: 0 },
  { value: '27', label: "信用证", xs: 0 },
  { value: '28', label: "福费廷", xs: 0 },

  { value: '16', label: "个人住房贷款", xs: -0.25 },
  { value: '17', label: "个人经营性贷款", xs: 0 },
  { value: '18', label: "个人消费贷款", xs: 0 },
  { value: '19', label: "其它个人贷款", xs: 0 },
  { value: '20', label: "外币贷款", xs: 0 },
  { value: '21', label: "个人商用房贷款", xs: 0 }
]
//存款业务类别
const CKYWLB = [
  { value: '31', label: "公司存款" },
  { value: '32', label: "单位结构性存款" },
  { value: '33', label: "机构理财" },
  { value: '34', label: "公司大额存单" },
  { value: '35', label: "外币公司存款" },
  { value: '36', label: "储蓄存款" },
  { value: '37', label: "个人结构性存款" },
  { value: '38', label: "个人保本理财" },
  { value: '39', label: "个人大额存单" },
  { value: '40', label: "外币储蓄存款" }
]
//直贴FTP
const FTPZT = [
  { value: '20200706', label: '直贴本币ftp价格-1个月' },
  { value: '20200707', label: '直贴本币ftp价格-2个月' },
  { value: '9922', label: '直贴本币ftp价格-3个月' },
  { value: '20200708', label: '直贴本币ftp价格-4个月' },
  { value: '20200709', label: '直贴本币ftp价格-5个月' },
  { value: '9904', label: '直贴本币ftp价格-6个月' },
  { value: '20200710', label: '直贴本币ftp价格-7个月' },
  { value: '20200711', label: '直贴本币ftp价格-8个月' },
  { value: '20200705', label: '直贴本币ftp价格-9个月' },
  { value: '20200712', label: '直贴本币ftp价格-10个月' },
  { value: '20200713', label: '直贴本币ftp价格-11个月' },
  { value: '9910', label: '直贴本币ftp价格-1年' }
]
//贷款FTP
const FTPDK = [
  // { value: '20170101', label: '人民币固定利率贷款-隔夜' },
  // { value: '20170102', label: '人民币固定利率贷款-1周' },
  // { value: '20170103', label: '人民币固定利率贷款-2周' },
  { value: '20170104', label: '人民币固定利率贷款-1个月' },
  { value: '20170105', label: '人民币固定利率贷款-3个月' },
  { value: '20170106', label: '人民币固定利率贷款-6个月' },
  { value: '20170107', label: '人民币固定利率贷款-1年' },
  { value: '20170108', label: '人民币固定利率贷款-2年' },
  { value: '20170109', label: '人民币固定利率贷款-3年' },
  { value: '20170110', label: '人民币固定利率贷款-4年' },
  { value: '20170111', label: '人民币固定利率贷款-5年' },
  { value: '20170112', label: '人民币固定利率贷款-6年' },
  { value: '20170113', label: '人民币固定利率贷款-7年' },
  { value: '20170114', label: '人民币固定利率贷款-8年' },
  { value: '20170115', label: '人民币固定利率贷款-10年' },
  { value: '20170116', label: '人民币固定利率贷款-15年' },
  { value: '20170117', label: '人民币固定利率贷款-20年' },
  { value: '20170201', label: '人民币浮动利率贷款-隔夜' },
  { value: '20170202', label: '人民币浮动利率贷款-1周' },
  { value: '20170203', label: '人民币浮动利率贷款-2周' },
  { value: '20170204', label: '人民币浮动利率贷款-1个月' },
  { value: '20170205', label: '人民币浮动利率贷款-3个月' },
  { value: '20170206', label: '人民币浮动利率贷款-6个月' },
  { value: '20170207', label: '人民币浮动利率贷款-1年' },
  { value: '20170208', label: '人民币浮动利率贷款-2年' },
  { value: '20170209', label: '人民币浮动利率贷款-3年' },
  { value: '20170210', label: '人民币浮动利率贷款-4年' },
  { value: '20170211', label: '人民币浮动利率贷款-5年' },
  { value: '20170212', label: '人民币浮动利率贷款-6年' },
  { value: '20170213', label: '人民币浮动利率贷款-7年' },
  { value: '20170214', label: '人民币浮动利率贷款-8年' },
  { value: '20170215', label: '人民币浮动利率贷款-10年' },
  { value: '20170216', label: '人民币浮动利率贷款-15年' },
  { value: '20170217', label: '人民币浮动利率贷款-20年' }
]
//对公存款FTP
const FTPDGCK = [
  { value: '20170301', label: '人民币对公存款-隔夜' },
  { value: '20170302', label: '人民币对公存款-1周' },
  { value: '20170303', label: '人民币对公存款-2周' },
  { value: '20170304', label: '人民币对公存款-1个月' },
  { value: '20170305', label: '人民币对公存款-3个月' },
  { value: '20170306', label: '人民币对公存款-6个月' },
  { value: '20170307', label: '人民币对公存款-1年' },
  { value: '20170308', label: '人民币对公存款-2年' },
  { value: '20170309', label: '人民币对公存款-3年' },
  { value: '20170310', label: '人民币对公存款-4年' },
  { value: '20170311', label: '人民币对公存款-5年' },
  { value: '20170312', label: '人民币对公存款-6年' },
  { value: '20170313', label: '人民币对公存款-7年' },
  { value: '20170314', label: '人民币对公存款-8年' },
  { value: '20170315', label: '人民币对公存款-10年' }
]
//储蓄存款FTP
const FTPCXCK = [
  { value: '20170401', label: '人民币储蓄存款-隔夜' },
  { value: '20170402', label: '人民币储蓄存款-1周' },
  { value: '20170403', label: '人民币储蓄存款-2周' },
  { value: '20170404', label: '人民币储蓄存款-1个月' },
  { value: '20170405', label: '人民币储蓄存款-3个月' },
  { value: '20170406', label: '人民币储蓄存款-6个月' },
  { value: '20170407', label: '人民币储蓄存款-1年' },
  { value: '20170408', label: '人民币储蓄存款-2年' },
  { value: '20170409', label: '人民币储蓄存款-3年' },
  { value: '20170410', label: '人民币储蓄存款-4年' },
  { value: '20170411', label: '人民币储蓄存款-5年' },
  { value: '20170412', label: '人民币储蓄存款-6年' },
  { value: '20170413', label: '人民币储蓄存款-7年' },
  { value: '20170414', label: '人民币储蓄存款-8年' },
  { value: '20170415', label: '人民币储蓄存款-10年' },
]
//保本理财FTP
const FTPBBLC = [
  { value: '20170501', label: '人民币保本理财-隔夜' },
  { value: '20170502', label: '人民币保本理财-1周' },
  { value: '20170503', label: '人民币保本理财-2周' },
  { value: '20170504', label: '人民币保本理财-1个月' },
  { value: '20170505', label: '人民币保本理财-3个月' },
  { value: '20170506', label: '人民币保本理财-6个月' },
  { value: '20170507', label: '人民币保本理财-1年' },
  { value: '20170508', label: '人民币保本理财-2年' },
  { value: '20170509', label: '人民币保本理财-3年' },
  { value: '20170510', label: '人民币保本理财-4年' },
  { value: '20170511', label: '人民币保本理财-5年' }
]
//外币存贷款FTP
const FTPWBCDK = [
  // { value: '20170601', label: '外币存贷款-隔夜' },
  // { value: '20170602', label: '外币存贷款-1周' },
  // { value: '20170603', label: '外币存贷款-2周' },
  { value: '20170604', label: '外币存贷款-1个月' },
  { value: '20170605', label: '外币存贷款-3个月' },
  { value: '20170606', label: '外币存贷款-6个月' },
  { value: '20170607', label: '外币存贷款-1年' },
  { value: '20170608', label: '外币存贷款-2年' },
  { value: '20170609', label: '外币存贷款-3年' },
  { value: '20170610', label: '外币存贷款-4年' },
  { value: '20170611', label: '外币存贷款-5年' }
]
//公司结构性存款FTP
const FTPGSJGX = [
  { value: '20170701', label: '人民币公司结构性存款-隔夜' },
  { value: '20170702', label: '人民币公司结构性存款-1周' },
  { value: '20170703', label: '人民币公司结构性存款-2周' },
  { value: '20170704', label: '人民币公司结构性存款-1个月' },
  { value: '20170705', label: '人民币公司结构性存款-3个月' },
  { value: '20170706', label: '人民币公司结构性存款-6个月' },
  { value: '20170707', label: '人民币公司结构性存款-1年' }
]
//个人结构性存款FTP
const FTPGRJGX = [
  { value: '20170801', label: '人民币个人结构性存款-隔夜' },
  { value: '20170802', label: '人民币个人结构性存款-1周' },
  { value: '20170803', label: '人民币个人结构性存款-2周' },
  { value: '20170804', label: '人民币个人结构性存款-1个月' },
  { value: '20170805', label: '人民币个人结构性存款-3个月' },
  { value: '20170806', label: '人民币个人结构性存款-6个月' },
  { value: '20170807', label: '人民币个人结构性存款-1年' }
]
//同业直投业务FTP
const FTPTYZT = [
  { value: '20190701', label: '信贷类同业投资FTP-7天' },
  { value: '20190702', label: '信贷类同业投资FTP-14天' },
  { value: '20190703', label: '信贷类同业投资FTP-1个月' },
  { value: '20190704', label: '信贷类同业投资FTP-2个月' },
  { value: '20190705', label: '信贷类同业投资FTP-3个月' },
  { value: '20190706', label: '信贷类同业投资FTP-4个月' },
  { value: '20190707', label: '信贷类同业投资FTP-5个月' },
  { value: '20190708', label: '信贷类同业投资FTP-6个月' },
  { value: '20190709', label: '信贷类同业投资FTP-9个月' },
  { value: '20190710', label: '信贷类同业投资FTP-1年' },
  { value: '20190711', label: '信贷类同业投资FTP-2年' },
  { value: '20190712', label: '信贷类同业投资FTP-3年' },
  { value: '20190713', label: '信贷类同业投资FTP-4年' },
  { value: '20190714', label: '信贷类同业投资FTP-5年' },
  { value: '20190715', label: '信贷类同业投资FTP-6年' },
  { value: '20190716', label: '信贷类同业投资FTP-7年' },
  { value: '20190717', label: '信贷类同业投资FTP-8年' },
  { value: '20190718', label: '信贷类同业投资FTP-9年' },
  { value: '20190719', label: '信贷类同业投资FTP-10年' },
]
//业务类别与FTP对应关系
const YWLB_FTPCS = {
  '11': FTPDK,
  '12': FTPDK,
  '13': FTPDK,
  '22': FTPDK,
  '23': FTPDK,
  '14': FTPZT,
  '15': FTPTYZT,
  '16': FTPDK,
  '17': FTPDK,
  '18': FTPDK,
  '19': FTPDK,
  '20': FTPWBCDK,
  '21': FTPDK,
  '31': FTPDGCK,
  '32': FTPGSJGX,
  '33': FTPBBLC,
  '34': FTPBBLC,
  '35': FTPWBCDK,
  '36': FTPCXCK,
  '37': FTPGRJGX,
  '38': FTPBBLC,
  '39': FTPBBLC,
  '40': FTPWBCDK
}
const JJZB_LSYW_DBFX = [
  { value: '1', label: '质押-存单', xs: 0 },
  { value: '2', label: '质押-政府债券', xs: 0 },
  { value: '3', label: '质押-人民币理财', xs: 0.25 },
  { value: '4', label: '质押-应收账款', xs: 1 },
  { value: '5', label: '质押-股票/股权', xs: 1 },
  { value: '6', label: '质押-权利质押', xs: 1 },
  { value: '7', label: '质押-其他质押', xs: 1 },
  { value: '8', label: '抵押-居住用房', xs: 0.7 },
  { value: '9', label: '抵押-商业性用房', xs: 0.8 },
  { value: '10', label: '抵押-土地使用权', xs: 0.8 },
  { value: '11', label: '抵押-车辆', xs: 1 },
  { value: '12', label: '抵押-其他抵押', xs: 100 },
]
const JJZB_LSYW_YWPZ = [
  { value: '1', label: '零售业务-表内业务-个人住房贷款', xs: 0.5 },
  { value: '2', label: '零售业务-表内业务-个人汽车贷款', xs: 0.75 },
  { value: '3', label: '零售业务-表内业务-个人商用房贷款', xs: 0.75 },
  { value: '4', label: '零售业务-表内业务-个人助学贷款', xs: 0.75 },
  { value: '5', label: '零售业务-表内业务-个人抵质押贷款', xs: 0.75 },
  { value: '6', label: '零售业务-表内业务-个人保证贷款', xs: 0.8 },
  { value: '7', label: '零售业务-表内业务-个人信用贷款', xs: 1 },
  { value: '8', label: '零售业务-表内业务-其他贷款', xs: 1 },
  { value: '9', label: '零售业务-表内业务-信用卡透支', xs: 0.75 },
  { value: '10', label: '零售业务-表外业务-信用卡未使用额度', xs: 0.375 },
  //{ value: '11', label: '零售业务-表外业务-信用卡未使用额度CCF', xs: 0.5 }
]
const JJZB_DGYW_CPQZ = [
  { value: '1', label: '公司业务-表内业务-一般贷款', xs: 1 },
  { value: '2', label: '公司业务-表内业务-贸易融资', xs: 0.75 },
  { value: '3', label: '公司业务-表内业务-各项垫款', xs: 1 },
  { value: '4', label: '公司业务-表内业务-银行承兑汇票贴现', xs: 0.2 },
  { value: '5', label: '公司业务-表内业务-商业承兑汇票贴现', xs: 1 },
  { value: '6', label: '公司业务-表内业务-买入外币票据', xs: 1 },
  { value: '14', label: '公司业务-表内业务-同业直投', xs: 1 },
  { value: '15', label: '公司业务-表内业务-信用债', xs: 1 },
  { value: '7', label: '公司业务-表外业务-银行承兑汇票', xs: 1 },
  { value: '8', label: '公司业务-表外业务-融资类保函', xs: 1 },
  { value: '9', label: '公司业务-表外业务-非融资保函及其他担保', xs: 0.5 },
  //{ value: '10', label: '公司业务-表外业务-非融资保函及其他担保CCF', xs: 0.5 },
  { value: '11', label: '公司业务-表外业务-信用证', xs: 0.2 },
  //{ value: '12', label: '公司业务-表外业务-信用证CCF', xs: 0.2 },
  { value: '13', label: '公司业务-表外业务-贷款承诺', xs: 0.5 },

]
const JJZB_DGYW_KHPJ = [
  { value: '1', label: '1', xs: 0.4 },
  { value: '2', label: '2', xs: 0.4 },
  { value: '3', label: '3', xs: 0.75 },
  { value: '4', label: '4', xs: 0.75 },
  { value: '5', label: '5', xs: 1 },
  { value: '6', label: '6', xs: 1 },
  { value: '7', label: '7', xs: 1.25 },
  { value: '8', label: '8', xs: 1.25 },
  { value: '9', label: '9', xs: 1.25 },
  { value: '10', label: '10', xs: 2.3 },
  { value: '11', label: '11', xs: 2.3 },
  { value: '12', label: '12', xs: 2.3 },
  { value: '13', label: '13', xs: 2.3 },
  { value: '14', label: '未评级', xs: 1.25 },
]
const JJZB_DGYW_DZYLX = [
  { value: '1', label: '质押' },
  { value: '2', label: '抵押' }
]
const JJZB_DGYW_ZYXS = [
  { value: '1', label: '质押-金融质押品-现金及其等价物-保证金', xs: 1 },
  { value: '2', label: '质押-金融质押品-现金及其等价物-存单', xs: 0 },
  { value: '3', label: '质押-金融质押品-现金及其等价物-理财产品', xs: 0.25 },
  { value: '4', label: '质押-金融质押品-现金及其等价物-现汇', xs: 0 },
  { value: '5', label: '质押-金融质押品-票据-中国人民银行票据', xs: 0 },
  { value: '6', label: '质押-金融质押品-票据-商业银行本票/银行汇票', xs: 0.25 },
  { value: '7', label: '质押-金融质押品-票据-银行承兑汇票', xs: 0.25 },
  { value: '8', label: '质押-金融质押品-票据-商业承兑汇票', xs: 0.8 },
  { value: '9', label: '质押-金融质押品-票据-票据池', xs: 0.25 },
  { value: '10', label: '质押-金融质押品-债券-国债', xs: 0 },
  { value: '11', label: '质押-金融质押品-保单-其他具有现金价值的保险单', xs: 0.5 },
  { value: '12', label: '质押-金融质押品-股票-基金', xs: 0.8 },
  { value: '13', label: '质押-金融质押品-贵金属-黄金', xs: 0 },
  { value: '14', label: '质押-应收账款-应收账款-应收账款', xs: 0.8 },
  { value: '15', label: '质押-应收账款-交易类应收账款-交易类应收账款', xs: 0.8 },
  { value: '16', label: '质押-应收账款-公路收费权-公路收费权', xs: 0.8 },
  { value: '17', label: '质押-应收账款-其他收费权-城市基础设施收费权', xs: 0.8 },
  { value: '18', label: '质押-应收账款-其他收费权-农村电网建设与改造工程电费收费权', xs: 0.8 },
  { value: '19', label: '质押-应收账款-其他收费权-提供其他公共服务产生的收费权', xs: 0.8 },
  { value: '20', label: '质押-应收账款-其他收费权-污水处理收费权', xs: 0.8 },
  { value: '21', label: '质押-其他质押品-出口退税账户-出口退税账户', xs: 0.8 },
  { value: '22', label: '质押-其他质押品-流动资产-保函', xs: 0.25 },
  { value: '23', label: '质押-其他质押品-流动资产-仓单', xs: 0.7 },
  { value: '24', label: '质押-其他质押品-流动资产-提单', xs: 0.7 },
  { value: '25', label: '质押-其他质押品-无形资产-可转让知识产权的财产权', xs: 1 },
  { value: '26', label: '质押-其他质押品-无追索权保理-无追索权保理', xs: 0.9 },
  { value: '27', label: '质押-其他质押品-有追索权保理-有追索权保理', xs: 0.8 },
  { value: '28', label: '质押-其他质押品-其他质押品-其他质押品', xs: 0.9 },
  { value: '29', label: '质押-缺失-缺失-缺失', xs: 0.9 }
]
const JJZB_DGYW_DYXS = [
  { value: '30', label: '抵押-商用房地产和居住用房地产-居住用房地产-居住用房', xs: 0.9 },
  { value: '31', label: '抵押-商用房地产和居住用房地产-商用房地产-办公用房', xs: 0.9 },
  { value: '32', label: '抵押-商用房地产和居住用房地产-商用房地产-工业用房', xs: 1 },
  { value: '33', label: '抵押-商用房地产和居住用房地产-商用房地产-商业用房', xs: 0.9 },
  { value: '34', label: '抵押-商用房地产和居住用房地产-居住用建设用地使用权-商用建设用地使用权', xs: 0.9 },
  { value: '35', label: '抵押-商用房地产和居住用房地产-土地使用权及在建工程-土地使用权及在建工程', xs: 0.9 },
  { value: '36', label: '抵押-商用房地产和居住用房地产-房产类在建工程-居住用房产类在建工程', xs: 0.9 },
  { value: '37', label: '抵押-商用房地产和居住用房地产-房产类在建工程-商用房产类在建工程', xs: 0.9 },
  { value: '38', label: '抵押-其他抵押品-机器设备-电气设备', xs: 1 },
  { value: '39', label: '抵押-其他抵押品-机器设备-电子产品及通信设备', xs: 1 },
  { value: '40', label: '抵押-其他抵押品-机器设备-通用设备', xs: 1 },
  { value: '41', label: '抵押-其他抵押品-机器设备-专用设备', xs: 1 },
  { value: '42', label: '抵押-其他抵押品-机器设备-机器设备（不能独立设定抵押）', xs: 1 },
  { value: '43', label: '抵押-其他抵押品-交通运输设备-车辆', xs: 1 },
  { value: '44', label: '抵押-其他抵押品-交通运输设备-船舶', xs: 1 },
  { value: '45', label: '抵押-其他抵押品-管网、设备-管网、设备', xs: 1 },
  { value: '46', label: '抵押-其他抵押品-流动资产-存货', xs: 1 },
  { value: '47', label: '抵押-其他抵押品-流动资产-流动资产', xs: 1 },
  { value: '48', label: '抵押-其他抵押品-设施类在建工程-设施类在建工程', xs: 1 },
  { value: '49', label: '抵押-其他抵押品-资源资产-森林资源', xs: 1 },
  { value: '50', label: '抵押-其他抵押品-资源资产-资源资产', xs: 1 },
  { value: '51', label: '抵押-缺失-缺失-缺失', xs: 1 }
]
const JJZB_DGYW_DBBZLX = [
  { value: '1', label: '专业担保公司担保', xs: 1 },
  { value: '2', label: '一般法人保证', xs: 1 },
  { value: '3', label: '自然人保证', xs: 1 },
  { value: '4', label: '备用信用证保证', xs: 0.25 },
  { value: '5', label: '银行保函保证', xs: 0.25 },
  { value: '6', label: '集团母公司担保', xs: 1 },
  { value: '7', label: '市区政府承诺函保证', xs: 1 },
  { value: '8', label: '担保基金保证', xs: 1 },
  { value: '9', label: '其他保证', xs: 1 },
  { value: '10', label: '缺失', xs: 1 },
]
const JJZB_DGYW_BZRXS = [
  { value: '1', label: '0-1', xs: 0.95 },
  { value: '2', label: '0-2', xs: 0.95 },
  { value: '3', label: '0-3', xs: 0.95 },
  { value: '4', label: '1', xs: 0.95 },
  { value: '5', label: '2', xs: 0.95 },
  { value: '6', label: '3', xs: 1 },
  { value: '7', label: '4', xs: 1 },
  { value: '8', label: '5', xs: 1 },
  { value: '9', label: '6', xs: 1 },
  { value: '10', label: '7', xs: 1 },
  { value: '11', label: '8', xs: 1 },
  { value: '12', label: '9', xs: 1 },
  { value: '13', label: '10', xs: 1 },
  { value: '14', label: '11', xs: 1 },
  { value: '15', label: '12', xs: 1 },
  { value: '16', label: '13', xs: 1 },
  { value: '17', label: '未评级', xs: 1 },
]
const JJZB_DGYW_QX = [
  { value: '1', label: '3个月以内（含）', xs: 0.90 },
  { value: '2', label: '3个月-6个月（含）', xs: 0.95 },
  { value: '3', label: '6个月-1年（含）', xs: 1 },
  { value: '4', label: '1年-3年（含）', xs: 1.1 },
  { value: '5', label: '3年-5年（含）', xs: 1.1 },
  { value: '6', label: '5年-10年（含）', xs: 1.1 },
  { value: '7', label: '10年以上', xs: 1.1 },
]
const JJZB_DGYW_GM = [
  { value: '1', label: '符合标准的小微企业', xs: 0.75 },
  { value: '2', label: '中小企业（不含小微企业）', xs: 0.85 },
  { value: '3', label: '一般公司', xs: 1 },
]
const JJZB_DGYW_HY = [
  { value: '1', label: '黑色金属冶炼和压延加工业', xs: 1.2 },
  { value: '2', label: '铝冶炼', xs: 1.2 },
  { value: '3', label: '水泥、石灰和石膏制造', xs: 1.2 },
  { value: '4', label: '平板玻璃制造', xs: 1.2 },
  { value: '5', label: '船舶及相关装置制造', xs: 1.2 },
  { value: '6', label: '房地产业', xs: 1.5 },
  { value: '7', label: '采矿业', xs: 1.2 },
  { value: '8', label: '其他', xs: 1 },
]
let PNAME_DATAS = {
  'zc_ywpz': ZCYWLB,
  'zc_ftp': FTPDK,
  'ck_ywpz': CKYWLB,
  'ck_ftp': FTPDGCK,
  'jg_cpqz': JJZB_DGYW_CPQZ,
  'jg_khpj': JJZB_DGYW_KHPJ,
  'jg_dzylx': JJZB_DGYW_DZYLX,
  'jg_dzyfs': JJZB_DGYW_ZYXS,
  'jg_dbbzlx': JJZB_DGYW_DBBZLX,
  'jg_bzrpj': JJZB_DGYW_BZRXS,
  'jg_qx': JJZB_DGYW_QX,
  'jg_gm': JJZB_DGYW_GM,
  'jg_hy': JJZB_DGYW_HY,
  'js_cpqz': JJZB_LSYW_YWPZ,
  'js_dbfs': JJZB_LSYW_DBFX,
  'jz_bnpj': NBPJ_JZLTBL,
  'jz_bwpj': NBPJ_JZLTBL
}
const QX_HKJH = []
//const QX_HKJH = [6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96, 102, 108, 114, 120, 132, 144, 156, 168, 180]
const EditFrom = dataEditCreate(daoName);
class evaCalcForm extends Component {
  constructor(props) {
    super(props);
    this.state = {
      dataChange: false,
      qxValue: "",
      params: {},
    };
  }
  componentDidMount() {
  };
  mnlrCalcHandler() {
    const formzc = this.refs.formzc.getForm();
    const formck = this.refs.formck.getForm();
    const formzs = this.refs.formzs.getForm();
    const { zc_je, ck_je, zs_je } = this.props.params
    let isok = true
    if (zc_je && zc_je > 0) {
      formzc.validateFields((err) => {
        if (err) {
          isok = false
        }
      })
    }
    if (ck_je && ck_je > 0) {
      formck.validateFields((err) => {
        if (err) {
          isok = false
        }
      })
    }
    if (zs_je && zs_je > 0) {
      formzs.validateFields((err) => {
        if (err) {
          isok = false
        }
      })
    }
    const qxData = this.refs.qxTable.getAllData()
    let total = 0
    let qxSum = 0
    let dkqx = 0
    qxData.map(item => {
      if (item.hkje) {
        const hkje = parseFloat(item.hkje)
        if (hkje > 0) {
          total = total + hkje
          dkqx = parseFloat(item.qx)
          qxSum = qxSum + dkqx * hkje
        }
      }
    })
    const je = parseFloat(zc_je)
    if (je > 0 && total > 0 && je !== total) {
      message.error("还款计划的总金额必须等于贷款金额！")
      isok = false
    }
    const zc_qxxs = qxSum / je / 12
    if (!isok) {
      return
    }
    // formzc.resetFields()
    this.mnlrCalc(qxData, zc_qxxs)
  };
  mnlrCalc(qxData, zc_qxxs) {
    
    let { zc_je, zc_ftpxs, zc_ftpts, zc_sqlv, ck_je, ck_ftpxs, ck_ftpts, ck_sqlv, zs_sqzs, zs_qx, zc_ywpz } = this.props.params
    const keyVals = {}
    if (zc_ywpz === '14' || zc_ywpz === '15' || zc_ywpz === '24' || zc_ywpz === '25' || zc_ywpz === '26' || zc_ywpz === '27' || zc_ywpz === '28') {
      const formck = this.refs.formzc.getForm();
      formck.validateFields((err, values) => {
        if (!err) {
          zc_ftpxs = values.zc_ftpxs
          zc_ftpts = values.zc_ftpts
        }
      })
    }
    const dkqx = zc_qxxs ? zc_qxxs * 365 : parseFloat(zc_ftpts)
    keyVals.zc_ftpts = dkqx
    if (zc_je && zc_ftpxs && zc_ftpts && zc_sqlv) {
      const dkqx = zc_qxxs ? zc_qxxs * 365 : parseFloat(zc_ftpts)
      keyVals.zc_ftpts = dkqx
      const je = parseFloat(zc_je)
      const ftpxs = parseFloat(zc_ftpxs)
      const sqlv = parseFloat(zc_sqlv)
      let zhxs = 1.06
      if (zc_ywpz === '15') {
        zhxs = 1.03
      }
      keyVals.mnlr_zclr = (je * 10000 * (sqlv / zhxs - ftpxs) / 100 * dkqx / 365).toFixed(2)
    }

    const formck = this.refs.formck.getForm();
    formck.validateFields((err, values) => {
      if (!err) {
        ck_ftpts = values.ck_ftpts
      }
    })
    if (ck_je && ck_ftpxs && ck_ftpts && ck_sqlv) {
      const je = parseFloat(ck_je)
      const ftpxs = parseFloat(ck_ftpxs)
      const sqlv = parseFloat(ck_sqlv)
      keyVals.mnlr_cklr = (je * 10000 * (ftpxs - sqlv) / 100 * ck_ftpts / 365).toFixed(2)
    }
    if (zs_sqzs) {
      keyVals.mnlr_shzs = (zs_sqzs / 1.06).toFixed(2)
    }
    let cklr = 0
    if (keyVals.mnlr_cklr) {
      cklr = keyVals.mnlr_cklr
    }
    let dklr = 0
    // if (keyVals.mnlr_shzs) {

    // }
    dklr = keyVals.mnlr_zclr
    let shzs = 0
    if (keyVals.mnlr_shzs) {
      shzs = keyVals.mnlr_shzs
    }
    shzs = shzs === undefined ? 0 : shzs
    dklr = dklr === undefined ? 0 : dklr
    cklr = cklr === undefined ? 0 : cklr
    keyVals.mnlr_hjlr = (parseFloat(dklr) + parseFloat(cklr) + parseFloat(shzs)).toFixed(2)
    // if (!keyVals.mnlr_hjlr) {
    //   keyVals.mnlr_hjlr = 0
    // }
    keyVals.qxData = qxData
    keyVals.zc_qxxs = zc_qxxs
    this.props.dispatch({
      type: `${daoName}/saveParams`,
      payload: { keyVals }
    });
  }
  CkMnlrClearHandler() {
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'ck_ywpz', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'ck_ftp', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'ck_ftpxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'ck_ftpts', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'ck_je', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'ck_sqlv', value: '' }
    });
    const formck = this.refs.formck.getForm();
    formck.resetFields()
  }
  ZsMnlrClearHandler() {
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zs_je', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zs_fl', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zs_qx', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zs_sqzs', value: '' }
    });
    const formzs = this.refs.formzs.getForm();
    formzs.resetFields()
  }
  ZcMnlrClearHandler() {
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_ywpz', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_ftp', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_ftpxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_ftpts', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_czcb', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_tdfl', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_sqlv', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'zc_je', value: '' }
    });
    const formzc = this.refs.formzc.getForm();
    formzc.resetFields()
  }
  JzzbClearHandler() {
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jz_xzbn', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jz_bnpj', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jz_bnpjxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jz_xzbw', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jz_bwpj', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jz_bwpjxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jzzb_hj', value: null }
    });
    const formjz = this.refs.formjz.getForm();
    formjz.resetFields()
  }
  JjzbClearHandler() {
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_cpqz', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_cpqzxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_khpj', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_khpjxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_dzylx', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_dzyfs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_dzyfsxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_dbbzlx', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_bzrpj', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_dbbzlxxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_qx', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_qxxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_gm', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_gmxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_hy', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_hyxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jg_bzjbl', value: '' }
    });

    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'js_cpqz', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'js_cpqzxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'js_dbfs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'js_dbfsxs', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'js_bzjbl', value: '' }
    });

    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jjzb_zbcb', value: '' }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'jjzb_zbzy', value: '' }
    });

    const formjg = this.refs.formjg.getForm();
    formjg.resetFields()
    const formjs = this.refs.formjs.getForm();
    formjs.resetFields()
  }
  AllClearHandler() {
    this.MnlrClearHandler()
    this.JzzbClearHandler()
    this.JjzbClearHandler()
  }
  MnlrClearHandler() {
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'qxData', value: [] }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'mnlr_hjlr', value: null }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'mnlr_shzs', value: null }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'mnlr_cklr', value: null }
    });
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'mnlr_zclr', value: null }
    });
    this.CkMnlrClearHandler()
    this.ZsMnlrClearHandler()
    this.ZcMnlrClearHandler()
  }
  jjzbCalcHandler() {
    const { zc_ywpz, zc_je, zc_ftpts } = this.props.params
    if (!zc_ywpz) {
      message.error("必须在资产利润中选择业务品种！")
      return
    }
    // if (!zc_ftpts) {
    //   message.error("必须在资产利润中输入期限！")
    //   return
    // }
    if (!zc_je) {
      message.error("必须在资产利润输入金额！")
      return
    }
    let formjj = this.refs.formjg;
    if (zc_ywpz === "16" || zc_ywpz === "17" || zc_ywpz === "18" || zc_ywpz === "19") {
      formjj = this.refs.formjs;
    }
    let isok = true
    formjj.getForm().validateFields((err) => {
      if (err) {
        isok = false
      }
    })
    if (!isok) {
      return
    }
    this.jjzbCalc()
  };
  jjzbCalc() {
    const { zc_ywpz, zc_je, zc_ftpts, jg_cpqz, jg_cpqzxs, jg_khpjxs, jg_dzyfsxs, jg_dbbzlxxs, jg_qxxs, jg_gmxs, jg_hyxs, jg_bzjbl, js_cpqz, js_cpqzxs, js_dbfsxs, js_bzjbl, jz_bnpjxs, jz_bwpjxs } = this.props.params
    const keyVals = {}
    const je = parseFloat(zc_je)
    const qxxs = parseFloat(zc_ftpts)
    if (zc_ywpz === "16" || zc_ywpz === "17" || zc_ywpz === "18" || zc_ywpz === "19") {
      let jtbl = jz_bnpjxs
      let bnbw = "表内"
      if (parseInt(js_cpqz) >= 10) {
        jtbl = jz_bwpjxs
        bnbw = "表外"
      }
      if (jtbl === undefined || jtbl === null|| jtbl === "NaN") {
        message.error(`请输入${bnbw}减值！`)
        return
      }
      jtbl = parseFloat(jtbl) / 100
      const lscpqzxs = parseFloat(js_cpqzxs)
      const lsdbfsxs = parseFloat(js_dbfsxs)
      const bzjbl = parseFloat(js_bzjbl)
      keyVals.jjzb_zbzy = 0.105 * je * 10000 * (1 - bzjbl / 100) * (1 - jtbl) * lscpqzxs * lsdbfsxs * qxxs / 365
    } else {
      let jtbl = jz_bnpjxs
      let bnbw = "表内"
      if (parseInt(jg_cpqz) >= 7) {
        jtbl = jz_bwpjxs
        bnbw = "表外"
      }
      if (jtbl === undefined || jtbl === null|| jtbl === "") {
        message.error(`请输入${bnbw}减值！`)
        return
      }

      jtbl = parseFloat(jtbl) / 100
      const bzjbl = parseFloat(jg_bzjbl)
      const cpqzxs = parseFloat(jg_cpqzxs)
      const khpjxs = parseFloat(jg_khpjxs)
      const dzyfsxs = parseFloat(jg_dzyfsxs)
      const dbbzlxxs = parseFloat(jg_dbbzlxxs)
      const dgqxxs = parseFloat(jg_qxxs)
      const gmxs = parseFloat(jg_gmxs)
      const hyxs = parseFloat(jg_hyxs)

      keyVals.jjzb_zbzy = 0.105 * je * 10000 * (1 - bzjbl / 100) * (1 - jtbl) * cpqzxs * khpjxs * dzyfsxs * dbbzlxxs * dgqxxs * gmxs * hyxs * qxxs / 365

      //0.105 * 4000 * 10000 * (1 - 0 / 100) * (1 - 0.026699999999999998) * 1 *  1.25 * 0.7 * 1 * 1.1 * 1 * 1.2 * 365 / 365
    }
    keyVals.jjzb_zbcb = keyVals.jjzb_zbzy * 0.065
    this.props.dispatch({
      type: `${daoName}/saveParams`,
      payload: { keyVals }
    });
  }
  jzzbCalcHandler() {
    const { jz_xzbn, jz_bnpjxs, jz_xzbw, jz_bwpjxs } = this.props.params
    if (!jz_xzbn && !jz_xzbw) {
      message.error("请输入表内或表外金额！")
      return
    }
    if (jz_xzbn && jz_bnpjxs === undefined) {
      message.error("请选择表内业务的内部评级！")
      return
    }
    if (jz_xzbw && jz_bwpjxs === undefined) {
      message.error("请选择表内业务的内部评级！")
      return
    }
    this.jzzbCalc()
  };
  jzzbCalc() {

    const { jz_xzbn, jz_bnpjxs, jz_xzbw, jz_bwpjxs } = this.props.params
    let xzbn = parseFloat(jz_xzbn)
    let bnpjxs = parseFloat(jz_bnpjxs)
    let xzbw = parseFloat(jz_xzbw)
    let bwpjxs = parseFloat(jz_bwpjxs)
    if (!xzbn) {
      xzbn = 0
    }
    if (!bnpjxs) {
      bnpjxs = 0
    }
    if (!xzbw) {
      xzbw = 0
    }
    if (!bwpjxs) {
      bwpjxs = 0
    }
    const keyVals = {}
    keyVals.jzzb_hj = xzbn * 10000 * bnpjxs / 100 + xzbw * 10000 * bwpjxs / 100
    this.props.dispatch({
      type: `${daoName}/saveParams`,
      payload: { keyVals }
    });
  }
  evaCalcHandler() {
    this.mnlrCalc()
    const { mnlr_hjlr, mnlr_zclr, zc_je, zc_ywpz, zc_ftpts, zc_ftpxs } = this.props.params
    // if (!mnlr_hjlr || !mnlr_zclr || !zc_je || !zc_ywpz || !zc_ftpts || !zc_ftpxs) {
    //   message.error("模拟利润录入不完整，请检查！")
    //   return false
    // }
    this.jjzbCalc()
    const { jjzb_zbcb } = this.props.params
    if (jjzb_zbcb === undefined) {
      message.error("资本成本录入不完整，请检查！")
      return false
    }
    this.jzzbCalc()
    const { jzzb_hj } = this.props.params
    if (jzzb_hj === undefined) {
      message.error("减值准备录入不完整，请检查！")
      return false
    }
    const keyVals = {}
    const mnlr = parseFloat(mnlr_hjlr)
    const zbcb = parseFloat(jjzb_zbcb)
    const jzzb = parseFloat(jzzb_hj)
    const ywje = parseFloat(zc_je) * 10000
    const ftpts = parseFloat(zc_ftpts)
    const ftp = parseFloat(zc_ftpxs)
    keyVals.eva_sdr = (mnlr - jzzb) * 0.25
    if (keyVals.eva_sdr < 0) {
      keyVals.eva_sdr = 0
    }
    keyVals.eva_sheva = mnlr - jzzb - zbcb - keyVals.eva_sdr
    let zhxs = 1.06
    if (zc_ywpz === '15') {
      zhxs = 1.03
    }
    keyVals.eva_zhcb = ((zbcb / ywje / ftpts * 365 / 0.75) + (jzzb / ywje / ftpts * 365) + ftp / 100) * 100 * zhxs
    this.props.dispatch({
      type: `${daoName}/saveParams`,
      payload: { keyVals }
    });
    return true
  };
  textHandler(key, e) {
    const value = e.target.value
    const keyVals = {
      [key]: value
    }
    if (key === "zc_czcb" || key === "zc_tdfl") {
      let { zc_czcb, zc_tdfl } = this.props.params
      if (key === "zc_czcb") {
        zc_czcb = value
      } else {
        zc_tdfl = value
      }
      if (zc_czcb && zc_tdfl) {
        const czcb = parseFloat(zc_czcb)
        const tdfl = parseFloat(zc_tdfl)
        keyVals.zc_sqlv = (czcb - tdfl)
        keyVals.zc_sqlv = keyVals.zc_sqlv.toFixed(4)
      }
    }
    const fName = 'form' + key.substr(0, 2)
    const form = this.refs[fName].getForm();
    form.validateFields((err, values) => {
      if (!err) {
        keyVals.ck_ftpts = values.ck_ftpts
      }
    })
    // form.resetFields();
    this.props.dispatch({
      type: `${daoName}/saveParams`,
      payload: { keyVals }
    });
  };
  changeHandler(key, tp, value) {
    const fName = 'form' + key.substr(0, 2)
    const form = this.refs[fName].getForm();
    form.resetFields();
    if (tp === 2) {
      this.props.dispatch({
        type: `${daoName}/setParam`,
        payload: { key, value, isFtp: true }
      });
    } else if (tp === 1) {
      const item = PNAME_DATAS[key].find(item => {
        return item.value === value
      })
      const keyVals = {
        [key]: value,
        [key + 'xs']: item.xs
      }
      if (key === "zc_ywpz") {
        keyVals.zc_ftp = null
        keyVals.zc_ftpts = null
        keyVals.zc_ftpxs = null
      } else if (key === "ck_ywpz") {
        keyVals.ck_ftp = null
        keyVals.ck_ftpts = null
        keyVals.ck_ftpxs = null
      }
      this.props.dispatch({
        type: `${daoName}/saveParams`,
        payload: { keyVals }
      });
    } else {
      this.props.dispatch({
        type: `${daoName}/setParam`,
        payload: { key, value, isFtp: false }
      });
    }
  }
  valChgHandler(value) {
    this.state.qxValue = '' + value
  }
  plusHandler() {
    let val = this.state.qxValue
    if (!val || val === "") {
      message.error("请输入要添加的期限！")
      return
    }
    let qxData = this.refs.qxTable.getAllData()
    for (let i = 0; i < qxData.length; i++) {
      if (val === qxData[i].qx) {
        message.error(`你输入的期限${val}已存在！`)
        return
      }
    }
    qxData.push({ qx: val })
    qxData = qxData.sort((a, b) => {
      return parseInt(a.qx) - parseInt(b.qx)
    })
    message.info(`期限${val}已添加！`)
    this.props.dispatch({
      type: `${daoName}/setParam`,
      payload: { key: 'qxData', value: qxData }
    });
  }
  deleteHandler() {
    Modal.confirm({
      title: '提示',
      content: `你确认要清空添加的期限吗？`,
      okText: '确认',
      cancelText: '取消',
      onOk: () => {
        this.props.dispatch({
          type: `${daoName}/setParam`,
          payload: { key: 'qxData', value: [] }
        });
      }
    });
  }
  exportHandler() {
    const qxData = this.refs.qxTable.getAllData()
    if (!this.evaCalcHandler()) {
      return
    }
    let form = document.createElement('form');//定义一个form表单
    const { params } = this.props
    form.style = "display:none";
    form.target = "_blank";
    form.method = "post";
    form.action = `/api/eva/export`;
    let input1 = document.createElement("input");
    input1.type = "hidden";
    input1.name = "params";
    input1.value = JSON.stringify(params);
    let input2 = document.createElement("input");
    input2.type = "hidden";
    input2.name = "qxData";
    input2.value = JSON.stringify(qxData);
    document.body.appendChild(form);//将表单放置在web中
    form.appendChild(input1);
    form.appendChild(input2);
    form.submit();
    document.body.removeChild(form)
  }
  render() {
    const { params } = this.props
    PNAME_DATAS['zc_ftp'] = YWLB_FTPCS[params.zc_ywpz]
    PNAME_DATAS['ck_ftp'] = YWLB_FTPCS[params.ck_ywpz]
    let MNLR_ZCYW_CONTROLS = [
      { name: 'zc_ywpz', required: false, type: 'select', label: '业务品种', grid: 24 / 24, data: PNAME_DATAS['zc_ywpz'], onChange: this.changeHandler.bind(this, 'zc_ywpz', 1) },
      { name: 'zc_ftp', required: false, type: 'select', label: 'FTP品种', grid: 24 / 24, data: PNAME_DATAS['zc_ftp'], onChange: this.changeHandler.bind(this, 'zc_ftp', 2) },
      { name: 'zc_ftpxs', type: 'disabled', label: 'FTP参数', grid: 12 / 24, layout: { labelSpan: 12, wrapperSpan: 12 } },
      { name: 'zc_ftpts', required: true, type: 'number', label: '期限(天)', grid: 12 / 24, layout: { labelSpan: 9, wrapperSpan: 11 } },
      { name: 'zc_czcb', type: 'disabled', label: '税前出账成本', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'zc_czcb') },
      { name: 'zc_tdfl', type: 'disabled', label: '通道费率%', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'zc_tdfl') },
      { name: 'zc_sqlv', required: false, type: 'number', label: '税前利率(%)', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'zc_sqlv') },
      { name: 'zc_je', required: true, type: 'number', label: '金额(万元)', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'zc_je') }
    ]
    const MNLR_CKYW_CONTROLS = [
      { name: 'ck_ywpz', required: false, type: 'select', label: '业务品种', grid: 24 / 24, data: PNAME_DATAS['ck_ywpz'], onChange: this.changeHandler.bind(this, 'ck_ywpz', 1) },
      { name: 'ck_ftp', required: false, type: 'select', label: 'FTP品种', grid: 24 / 24, data: PNAME_DATAS['ck_ftp'], onChange: this.changeHandler.bind(this, 'ck_ftp', 2) },
      { name: 'ck_ftpxs', type: 'disabled', label: 'FTP参数', grid: 12 / 24, layout: { labelSpan: 12, wrapperSpan: 12 } },
      { name: 'ck_ftpts', required: false, type: 'number', label: '期限(天)', grid: 12 / 24, layout: { labelSpan: 9, wrapperSpan: 11 } },
      { name: 'ck_sqlv', required: false, type: 'number', label: '存款利率(%)', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'ck_sqlv') },
      { name: 'ck_je', required: false, type: 'number', label: '金额(万元)', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'ck_je') },
    ]
    const MNLR_ZJYW_CONTROLS = [
      { name: 'zs_je', type: 'number', label: '金额(万元)', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'zs_je') },
      { name: 'zs_fl', type: 'number', label: '费率(%)', grid: 12 / 24, layout: { labelSpan: 12, wrapperSpan: 12 }, onBlur: this.textHandler.bind(this, 'zs_fl') },
      { name: 'zs_qx', type: 'number', label: '期限(天)', grid: 12 / 24, layout: { labelSpan: 9, wrapperSpan: 11 }, onBlur: this.textHandler.bind(this, 'zs_qx') },
      { name: 'zs_sqzs', type: 'number', label: '税前中收(元)', grid: 24 / 24, onBlur: this.textHandler.bind(this, 'zs_sqzs') },
    ]
    if (params.jg_dzylx === "2") {
      PNAME_DATAS['jg_dzyfs'] = JJZB_DGYW_DYXS
    } else {
      PNAME_DATAS['jg_dzyfs'] = JJZB_DGYW_ZYXS
    }
    //经济资本对公业务
    let JJZB_DGYW_CONTROLS = [
      {
        name: 'jg_cpqz', required: true, type: 'select', label: '产品权重', grid: 12 / 24,
        data: PNAME_DATAS.jg_cpqz, onChange: this.changeHandler.bind(this, 'jg_cpqz', 1)
      },
      { name: 'jg_cpqzxs', required: false, type: 'disabled', label: '产品权重系数', grid: 12 / 24, },
      {
        name: 'jg_khpj', required: true, type: 'select', label: '客户评级', grid: 12 / 24,
        data: PNAME_DATAS.jg_khpj, onChange: this.changeHandler.bind(this, 'jg_khpj', 1)
      },
      { name: 'jg_khpjxs', required: false, type: 'disabled', label: '客户评级系数', grid: 12 / 24, },
      {
        name: 'jg_dzylx', required: true, type: 'select', label: '抵质押类型', grid: 8 / 24,
        data: PNAME_DATAS.jg_dzylx, onChange: this.changeHandler.bind(this, 'jg_dzylx', 0), layout: { labelSpan: 9, wrapperSpan: 15 }
      },
      {
        name: 'jg_dzyfs', required: true, type: 'select', label: '抵质押方式', grid: 10 / 24,
        data: PNAME_DATAS.jg_dzyfs, layout: { labelSpan: 6, wrapperSpan: 18 },
        onChange: this.changeHandler.bind(this, 'jg_dzyfs', 1)
      },
      { name: 'jg_dzyfsxs', required: false, type: 'disabled', label: '抵质押系数', grid: 6 / 24, layout: { labelSpan: 10, wrapperSpan: 10 } },
      {
        name: 'jg_dbbzlx', required: true, type: 'select', label: '担保保证类型', grid: 8 / 24,
        data: PNAME_DATAS.jg_dbbzlx, onChange: this.changeHandler.bind(this, 'jg_dbbzlx', 1), layout: { labelSpan: 9, wrapperSpan: 15 }
      },
      {
        name: 'jg_bzrpj', required: true, type: 'select', label: '保证人评级', grid: 10 / 24,
        data: PNAME_DATAS.jg_bzrpj, onChange: this.changeHandler.bind(this, 'jg_bzrpj', 1), disabled: false, layout: { labelSpan: 6, wrapperSpan: 18 },
      },
      { name: 'jg_dbbzlxxs', required: false, type: 'disabled', label: '保证担保系数', grid: 6 / 24, layout: { labelSpan: 10, wrapperSpan: 10 } },
      {
        name: 'jg_qx', required: true, type: 'select', label: '期限', grid: 12 / 24,
        data: PNAME_DATAS.jg_qx, onChange: this.changeHandler.bind(this, 'jg_qx', 1)
      },
      { name: 'jg_qxxs', required: false, type: 'disabled', label: '期限系数', grid: 12 / 24 },
      {
        name: 'jg_gm', required: true, type: 'select', label: '规模', grid: 12 / 24,
        data: PNAME_DATAS.jg_gm, onChange: this.changeHandler.bind(this, 'jg_gm', 1)
      },
      { name: 'jg_gmxs', required: false, type: 'disabled', label: '规模系数', grid: 12 / 24 },
      {
        name: 'jg_hy', required: true, type: 'select', label: '行业', grid: 12 / 24,
        data: PNAME_DATAS.jg_hy, onChange: this.changeHandler.bind(this, 'jg_hy', 1)
      },
      { name: 'jg_hyxs', required: false, type: 'disabled', label: '行业系数', grid: 12 / 24 },
      { name: 'jg_bzjbl', required: true, type: 'number', label: '保证金比例%', grid: 12 / 24, placeholder: '请输入保证金比例...', onBlur: this.textHandler.bind(this, 'jg_bzjbl') },
    ];
    if (params.jg_dbbzlx !== '1' && params.jg_dbbzlx !== '2' && params.jg_dbbzlx !== '6') {
      JJZB_DGYW_CONTROLS[8].isDisabled = true
      JJZB_DGYW_CONTROLS[8].required = false
    }
    //经济资本零售业务
    const JJZB_LSYW_CONTROLS = [
      {
        name: 'js_cpqz', required: true, type: 'select', label: '产品权重', grid: 12 / 24,
        data: PNAME_DATAS.js_cpqz, layout: { labelSpan: 4, wrapperSpan: 19 }, onChange: this.changeHandler.bind(this, 'js_cpqz', 1)
      },
      { name: 'js_cpqzxs', required: false, type: 'disabled', label: '产品权重系数', grid: 12 / 24, },
      {
        name: 'js_dbfs', required: true, type: 'select', label: '担保方式', grid: 12 / 24,
        data: PNAME_DATAS.js_dbfs, layout: { labelSpan: 4, wrapperSpan: 19 }, onChange: this.changeHandler.bind(this, 'js_dbfs', 1)
      },
      { name: 'js_dbfsxs', required: false, type: 'disabled', label: '担保方式系数', grid: 12 / 24, },
      { name: 'js_bzjbl', required: true, type: 'number', label: '保证金比例%', grid: 12 / 24, placeholder: '请输入保证金比例...', onBlur: this.textHandler.bind(this, 'js_bzjbl') },
    ]
    const JZZB_CONTROLS = [
      { name: 'jz_xzbn', type: 'number', label: '新增表内资产规模(万)', grid: 10 / 24, onBlur: this.textHandler.bind(this, 'jz_xzbn'), layout: { labelSpan: 9, wrapperSpan: 15 } },
      { name: 'jz_bnpj', type: 'select', label: '内部评级', data: PNAME_DATAS.jz_bnpj, grid: 8 / 24, layout: { labelSpan: 6, wrapperSpan: 18 }, onChange: this.changeHandler.bind(this, 'jz_bnpj', 1) },
      { name: 'jz_bnpjxs', type: 'disabled', label: '减值计提比例%', grid: 6 / 24, layout: { labelSpan: 10, wrapperSpan: 14 }, onBlur: this.textHandler.bind(this, 'jz_bnpjxs') },
      { name: 'jz_xzbw', type: 'number', label: '新增表外资产规模(万)', grid: 10 / 24, onBlur: this.textHandler.bind(this, 'jz_xzbw'), layout: { labelSpan: 9, wrapperSpan: 15 } },
      { name: 'jz_bwpj', type: 'select', label: '内部评级', data: PNAME_DATAS.jz_bwpj, grid: 8 / 24, layout: { labelSpan: 6, wrapperSpan: 18 }, onChange: this.changeHandler.bind(this, 'jz_bwpj', 1) },
      { name: 'jz_bwpjxs', type: 'disabled', label: '减值计提比例%', grid: 6 / 24, layout: { labelSpan: 10, wrapperSpan: 14 }, onBlur: this.textHandler.bind(this, 'jz_bwpjxs') },
    ]
    const qxTitle = <div><span>期限(月)</span><InputNumber size="small" min={1} onChange={this.valChgHandler.bind(this)} /><Icon type="plus" onClick={this.plusHandler.bind(this)} />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<Icon type="delete" onClick={this.deleteHandler.bind(this)} /></div>
    const qx_columns = [
      { title: qxTitle, width: 100, dataIndex: 'qx', key: 'qx', dispaly: true },
      { title: '还款金额(万元)', width: 120, dataIndex: 'hkje', key: 'hkje', dispaly: true, canEdit: true },
    ];
    const qx_controls = [
      { name: "qx", label: "员工编号", type: "number", grid: 12 / 24 },
      { name: "hkje", label: "还款金额(万元)", type: "number", grid: 12 / 24 },
    ]
    let qx_data = params.qxData
    if (!qx_data) {
      qx_data = QX_HKJH.map(qx => { return { qx: '' + qx } })
    }
    if (params.zc_ywpz === '15') {
      MNLR_ZCYW_CONTROLS[4].type = "number"
      MNLR_ZCYW_CONTROLS[4].required = true
      MNLR_ZCYW_CONTROLS[5].type = "number"
      MNLR_ZCYW_CONTROLS[5].required = true
      MNLR_ZCYW_CONTROLS[6].type = "disabled"
      MNLR_ZCYW_CONTROLS[6].required = false
    }
    if (params.zc_ywpz === '14' || params.zc_ywpz === '15' || params.zc_ywpz === '24' || params.zc_ywpz === '25' || params.zc_ywpz === '26' || params.zc_ywpz === '27' || params.zc_ywpz === '28') {
      MNLR_ZCYW_CONTROLS[2].type = "number"
      MNLR_ZCYW_CONTROLS[2].required = false
      MNLR_ZCYW_CONTROLS[1].type = "disabled"
      MNLR_ZCYW_CONTROLS[1].required = false
    }
    if (params.zc_ywpz === '13') {
      MNLR_ZCYW_CONTROLS[2].type = "number"
      MNLR_ZCYW_CONTROLS[2].required = true
    }
    let isdg = true
    if (params.zc_ywpz === "16" || params.zc_ywpz === "17" || params.zc_ywpz === "18" || params.zc_ywpz === "19") {
      isdg = false
    }
    return <div style={{ background: '#ECECEC', overflowY: "scroll", marginTop: -16, padding: '5px 5px' }}>
      <Collapse accordion defaultActiveKey={['1']}>
        <Panel header="考核利润" key="1" style={{ padding: '0px 0px' }}>
          <Row gutter={16} >
            <Col span={12}>
              <Card title="资产业务" bordered={false} >
                <EditFrom ref="formzc" daoName={daoName} controls={MNLR_ZCYW_CONTROLS} record={params} selectFirst={false} />
                {/* <Button type="Primary" onClick={this.ZcMnlrClearHandler.bind(this)}>
                  <Icon type="retweet" />重置
                </Button> */}
                <DataEditTable height={115} columns={qx_columns} controls={qx_controls} ref="qxTable"
                  dataSource={qx_data} keyName="qx" daoName={daoName} canPage={false} pageSize={50} />
              </Card>
            </Col>
            <Col span={12}>
              <Card title="存款业务" bordered={false}>
                <EditFrom ref="formck" daoName={daoName} controls={MNLR_CKYW_CONTROLS} record={params} selectFirst={false} />
                {/* <Button type="Primary" onClick={this.CkMnlrClearHandler.bind(this)}>
                  <Icon type="retweet" />重置
                </Button> */}
              </Card>
              <Card title="中间业务" bordered={false}>
                <EditFrom ref="formzs" daoName={daoName} controls={MNLR_ZJYW_CONTROLS} record={params} selectFirst={false} />
                {/* <Button type="Primary" onClick={this.ZsMnlrClearHandler.bind(this)}>
                  <Icon type="retweet" />重置
                </Button> */}
              </Card>
            </Col>
          </Row>
          <div>
            <Button type="Primary" style={{ margin: 5 }} onClick={this.mnlrCalcHandler.bind(this)}>
              计算
            </Button>
            <Button type="Primary" onClick={this.MnlrClearHandler.bind(this)}>
              <Icon type="retweet" />重置
            </Button>
            <span>
              {params.mnlr_zclr !== undefined ? <span style={{ marginLeft: 30 }}>资产考核利润：{renderNumber(params.mnlr_zclr)}元</span> : null}
              {params.mnlr_cklr !== undefined ? <span style={{ marginLeft: 30 }}>存款考核利润：{renderNumber(params.mnlr_cklr)}元</span> : null}
              {params.mnlr_shzs !== undefined ? <span style={{ marginLeft: 30 }}>税后中收：{renderNumber(params.mnlr_shzs)}元</span> : null}
              {params.mnlr_hjlr !== undefined ? <span style={{ marginLeft: 30 }}>利润合计：{renderNumber(params.mnlr_hjlr)}元</span> : null}
            </span>
            <div>
              <span style={{ marginLeft: 30 }}>
                资产考核利润=业务金额*（税后利率-资产FTP）/365*天数
              </span>
              <span style={{ marginLeft: 30 }}>
                存款考核利润=业务金额*（存款FTP-存款利率）/365*天数
              </span>
            </div>
          </div>
        </Panel>
        <Panel header="减值准备" key="3">
          <EditFrom ref="formjz" daoName={daoName} controls={JZZB_CONTROLS} record={params} />
          <div>
            <Button type="Primary" style={{ margin: 5 }} onClick={this.jzzbCalcHandler.bind(this)}>
              计算
            </Button>
            <Button type="Primary" onClick={this.JzzbClearHandler.bind(this)}>
              <Icon type="retweet" />重置
            </Button>
            <span>
              {params.jzzb_hj !== undefined ? <span style={{ marginLeft: 30 }}>减值准备合计：{renderNumber(params.jzzb_hj)}元</span> : null}
            </span>
          </div>
        </Panel>
        <Panel header="经济资本" key="2">
          <div style={{ display: isdg ? "block" : "none" }}>
            <EditFrom ref="formjg" daoName={daoName} controls={JJZB_DGYW_CONTROLS} record={params} selectFirst={false} />
          </div>
          <div style={{ display: !isdg ? "block" : "none" }}>
            <EditFrom ref="formjs" daoName={daoName} controls={JJZB_LSYW_CONTROLS} record={params} selectFirst={false} />
          </div>
          <div>
            <Button type="Primary" style={{ margin: 5 }} onClick={this.jjzbCalcHandler.bind(this)}>
              计算
            </Button>
            <Button type="Primary" onClick={this.JjzbClearHandler.bind(this)}>
              <Icon type="retweet" />重置
            </Button>
            <span>
              {params.jjzb_zbzy !== undefined ? <span style={{ marginLeft: 30 }}>占用经济资本：{renderNumber(params.jjzb_zbzy)}元</span> : null}
              {params.jjzb_zbcb !== undefined ? <span style={{ marginLeft: 30 }}>经济资本成本：{renderNumber(params.jjzb_zbcb)}元</span> : null}
            </span>
            <div>
              <span style={{ marginLeft: 30 }}>
                经济资本=10.5%*敞口金额*（1-减值计提比例）*各项风险权重系数/365*天数
              </span>
              <span style={{ marginLeft: 30 }}>
                经济资本成本=经济资本*6.5%
              </span>
            </div>
          </div>
        </Panel>
        <Panel header="EVA" key="4">
          <div>
            <Button type="Primary" style={{ margin: 5 }} onClick={this.evaCalcHandler.bind(this)}>
              计算
            </Button>
            <Button type="Primary" style={{ margin: 5 }} onClick={this.exportHandler.bind(this)}>
              导出
            </Button>
            <Button type="Primary" onClick={this.AllClearHandler.bind(this)}>
              <Icon type="retweet" />重置全部
            </Button>
            <Row gutter={16} >
              <Col span={8}>
                {params.mnlr_hjlr !== undefined ? <span style={{ marginLeft: 30 }}>利润合计：{renderNumber(params.mnlr_hjlr)}元</span> : null}
              </Col>
              <Col span={8}>
                {params.jjzb_zbcb !== undefined ? <span style={{ marginLeft: 30 }}>经济资本成本：{renderNumber(params.jjzb_zbcb)}元</span> : null}
              </Col>
              <Col span={8}>
                {params.jzzb_hj !== undefined ? <span style={{ marginLeft: 30 }}>新增表内外资产减值：{renderNumber(params.jzzb_hj)}元</span> : null}
              </Col>
            </Row>
            <Row gutter={16} >
              <Col span={8}>
                {params.eva_sdr !== undefined ? <span style={{ marginLeft: 30 }}>所得税：{renderNumber(params.eva_sdr)}元</span> : null}
              </Col>
              <Col span={8}>
                {params.eva_sheva !== undefined ? <span style={{ marginLeft: 30 }}>税后EVA：{renderNumber(params.eva_sheva)}元</span> : null}
              </Col>
              <Col span={8}>
                {params.eva_zhcb !== undefined ? <span style={{ marginLeft: 30 }}>模拟EVA平衡综合成本：{renderNumber(params.eva_zhcb)}%</span> : null}
              </Col>
            </Row>
            <div>
              <span style={{ marginLeft: 30 }}>
                所得税=（考核利润-新增表内外资产减值）*25%
              </span>
              <span style={{ marginLeft: 30 }}>
                税后EVA=考核利润-新增表内外资产减值-资本成本-所得税
              </span>
              <div style={{ marginLeft: 30 }}>
                模拟EVA平衡综合成本%=（经济资本成本/业务金额/75%/期限*365+减值准备/业务金额/期限*365+贷款FTP）*1.06(贷款公式)
              </div>
              <div style={{ marginLeft: 30 }}>
                模拟EVA平衡综合成本%=（经济资本成本/业务金额/75%/期限*365+减值准备/业务金额/期限*365+贷款FTP）*1.03(直投公式)
              </div>
            </div>
          </div>
        </Panel>
      </Collapse>
    </div>
  }
}
function mapStateToProps(state) {
  const { params, results } = state.BaseEvaCalc;
  const { userID, orgID, pOrgID, popedomTypes } = state.menus;
  return {
    userID,
    orgID,
    pOrgID,
    popedomTypes,
    params, results
  }
}
evaCalcForm = connect(mapStateToProps)(evaCalcForm)
export default evaCalcForm;

let render = (props) => React.createElement(evaCalcForm, props);
let f = new Factory()
f.set("evaCalcForm", render)
